<template>
      <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i> 添加订单
        </el-breadcrumb-item>
        <el-breadcrumb-item>基本表单</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="form-box">
        <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="订单编号">
            <el-input v-model="form.orderNo"></el-input>
          </el-form-item>
          <el-form-item label="下单时间">
            <el-input type="Date" v-model="form.createTime"></el-input>
          </el-form-item>
        
           <el-form-item label="订单状态">
      <el-select v-model="form.orderStatus" placeholder="请选择订单状态">
        <el-option label="已支付" value="1"></el-option>
        <el-option label="未支付" value="2"></el-option>
        <el-option label="已发货" value="3"></el-option>
        <el-option label="未发货" value="4"></el-option>
        <el-option label="待收货" value="5"></el-option>
        <el-option label="已收货" value="6"></el-option>
      </el-select>
    </el-form-item>

   
               <el-form-item label="支付信息">
      <el-select v-model="form.payType" placeholder="请选择支付信息">
        <el-option label="在线支付" value="1"></el-option>
        <el-option label="货到付款" value="2"></el-option>
      </el-select>
    </el-form-item>
          <el-form-item label="支付时间">
            <el-input type="Date" v-model="form.payTime"></el-input>
          </el-form-item>
         
                  <el-form-item label="配送方式">
      <el-select v-model="form.shippingType" placeholder="请选择配送方式">
        <el-option label="京东快递" value="1"></el-option>
        <el-option label="顺丰快递" value="2"></el-option>
      </el-select>
    </el-form-item>
          <el-form-item label="配送时间">
            <el-input type="Date" v-model="form.shippingTime"></el-input>
          </el-form-item>
         <el-form-item>
            <el-button type="primary" @click="onSubmit">添加</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";

export default ({
    data() {
        return{
            form:{
                  orderNo:'',
                createTime:'',
                orderStatus:'',
                payType:'',
                payTime:'',
                shippingType:'',
            }
        }
    },
    methods:{
        onSubmit() {
      axios({
            url: "https://localhost:44310/api/app/addmin-oeder",
            method: "post",
            data: this.form,
        }).then((res) => {
            console.log(this.form);
            if (res.status == 204) {
            alert("添加成功");
            this.$router.push({ name: "OrderTable" });
            } else {
            alert("添加失败");
            }
        });
        },
    }
})
</script>
